package ytdp.careagle.com.ytdp.entity;

/**
 * Created by lida on 2017/10/30.
 */

public class VersionControlEntity {

    /**
     * name : 远程检测
     * description : null
     * lastAppVersion : 1.2.2
     * minAppVersion : null
     * downloadLink : https://www.pgyer.com/ycbj-a
     * platform : ANDROID
     */

    private String name;
    private Object description;
    private String lastAppVersion;
    private Object minAppVersion;
    private String downloadLink;

    // 校验app版本   true  是最新版本  不用管
    //   false  不是最新版本  提示更新
    public static boolean isNewVersion(String online, String local) {
        String[] onlineSp = online.split("\\.");
        String[] localSp = local.split("\\.");
        for (int i = 0; i < online.length(); i++) {
            if (Integer.valueOf(onlineSp[i]) > Integer.valueOf(localSp[i])) {
                return false;
            }

            if (Integer.valueOf(onlineSp[i]) < Integer.valueOf(localSp[i])) {
                return true;
            }
        }
        return true;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Object getDescription() {
        return description;
    }

    public void setDescription(Object description) {
        this.description = description;
    }

    public String getLastAppVersion() {
        return lastAppVersion;
    }

    public void setLastAppVersion(String lastAppVersion) {
        this.lastAppVersion = lastAppVersion;
    }

    public Object getMinAppVersion() {
        return minAppVersion;
    }

    public void setMinAppVersion(Object minAppVersion) {
        this.minAppVersion = minAppVersion;
    }

    public String getDownloadLink() {
        return downloadLink;
    }

    public void setDownloadLink(String downloadLink) {
        this.downloadLink = downloadLink;
    }

}
